-
Notifications
You must be signed in to change notification settings - Fork 730
fix(langchain/createAgent): various code updates after HITL changes #673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the createAgent API in documentation to align with recent HITL (Human-in-the-Loop) changes. The changes standardize import paths, parameter names, and configuration options across Python and JavaScript examples.
- Updates import paths to import middleware from the root "langchain" package instead of "langchain/middleware"
- Changes
tool_configsparameter tointerrupt_onin Python andtoolConfigstointerruptOnin JavaScript - Standardizes the use of
systemPromptparameter in JavaScript examples
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/oss/langchain/middleware.mdx | Updates middleware import paths, parameter names (tool_configs → interrupt_on, toolConfigs → interruptOn), and systemPrompt usage across multiple code examples |
| src/oss/langchain/agents.mdx | Updates middleware import path to use root "langchain" package |
| HumanInTheLoopRequest, | ||
| humanInTheLoopMiddleware, | ||
| } from "langchain"; | ||
| import { createAgent } from "langchain"; |
Copilot
AI
Sep 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The createAgent import is duplicated. It's already imported on line 596-601 in the same import block. Remove this duplicate import statement.
| import { createAgent } from "langchain"; |
| const result = await agent.invoke( | ||
| { | ||
| messages: [ | ||
| new HumanMessage( | ||
| "Write to greeting.txt with the content 'Hello, world!'" | ||
| ), | ||
| ], | ||
| }, | ||
| config | ||
| ); |
Copilot
AI
Sep 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new keyword is missing when creating the HumanMessage instance. This is inconsistent with other examples in the file and will cause a runtime error.
|
Preview ID generated: preview-cbagen-1759026889-ddde1c1 |
|
Preview ID generated: preview-cbagen-1759028230-c924c95 |
| middleware=[ | ||
| HumanInTheLoopMiddleware( | ||
| tool_configs={ | ||
| interrupt_on={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a different PR for HIL
|
closing as stale |
Various code updates after last week:
interrupt_oninstead oftool_configssystemPrompteverywhere in JScc @sydney-runkle @eyurtsev